import time
import tkinter
import threading
root=tkinter.Tk()
root.title('时间结束关闭')
root['width']=400
root['height']=300
root.resizable(False,False)
richText=tkinter.Text(root,width=380)
richText.place(x=10,y=10,width=380,height=200)
richText.insert('0.0','床前明月光，\n疑是地上霜，\n举头望明月，\n低头思故乡。')
IbTime=tkinter.Label(root,fg='red',anchor='w')
IbTime.place(x=10,y=250,width=150,height=20)
def autoClose():
    for i in range(5):
        IbTime['text']='剩余{}秒'.format(5-i)
        time.sleep(1)
    root.destroy()
t=threading.Thread(target=autoClose)
t.start()
root.mainloop()